<html>
<head>

</head>
<body>
	<form method="post">
		<select name="country">
			<option>-</option>
			<?php 
				$country = "";
				if($_POST)
				{
					$country = $_POST['country'];
				}
				
				$countries = array("Bulgaria", 
								   "Italy", 
								   "Germany", 
						           "Macedonia");
				$cities = array(
						"Bulgaria" => array("Sofia", "Pernik", "Varna"),
						"Italy"    => array("Rome", "Venice", "Milan"),
						"Germany"  => array("Munchen", "Cologne", "Hamburg"),
						"Macedonia" => array("Ohrid","Scopie","Bitolia")
						);
				
				for($i = 0; $i < count($countries); $i++)
				{
					$element = $countries[$i];
					if($country == $element)
					{
						echo "<option selected=\"selected\">$element</option>\n";
					}else 
					{
						echo "<option>$element</option>\n";
					}
					
				}
			?>			
		</select>
		<select name="cities">
			<option>-</option>
			<?php 
			if($country != "")
			{
				$current_cities = $cities[$country];
				
				foreach($current_cities as $c_city)
				{
					echo "<option>$c_city</option>";
				}
			}
			?>
		</select>
		<input type="submit" value="Send Me!"/>
	</form>
</body>
</html>
